package br.com.achemoda.negocio;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import br.com.achemoda.negocio.controller.Logica;

public class Logout implements Logica{

	@Override
	public void executa(HttpServletRequest request, HttpServletResponse response) throws Exception {
		System.out.println("to no logout");
		HttpSession sessao = request.getSession(); 
		
		if(sessao != null){
			sessao.removeAttribute("usuarioSessao");
			sessao.invalidate();
			System.out.println("sessao morreu");
        }
        
        response.sendRedirect("index.jsp");
	}

}
